; Example of use of z80unlze.asm
; Copyright © 2020 Pedro Gimeno Fortea

		org	0A000h

		jr	Start
FinalLength	dw	0

		; Example: Decompress a text and print it
Start:		ld	hl,CompressedStrm
		ld	de,0C000h
		call	unlze
		ld	bc,-CompressedStrm
		add	hl,bc
		ld	(FinalLength),hl

		ld	hl,0C000h
PrtLoop:	ld	a,l
		cp	e
		jr	nz,GoOn
		ld	a,h
		cp	d
		ret	z
GoOn:		ld	a,(hl)
		inc	hl
;		cp	0Ah
;		jr	nz,NonLF
;		ld	a,0Dh
;		rst	18h
;		ld	a,0Ah
NonLF:		rst	18h
		jr	PrtLoop

CompressedStrm:	incbin	'lorem_ip.txt.lz'


		include	'z80unlze.asm'
